This document describes how to install the packages needed for STATS 32, as well as how to check that the R markdown system is working fine on your machine. (We will learn more about what packages are later in the course.)

Installing packages

If the name of a package is pkgName, the command to install it is as follows:

install.packages("pkgName")

Type the command above into the console in RStudio and press Enter. (Note: You must put quotation marks around pkgName!) You should see a progress bar showing the progress of the download.

To check that the package has been downloaded and installed correctly, type the following into the console:

library(pkgName)

If the package has been correctly installed, you will not see an error message. Some notes about installation:

Install the following list of packages; we will be using them at various parts of the course.

If you are unable to install any of the packages, please check in with me. If emailing, tell me what you did, the error you encountered, your R & RStudio versions and the operating system you are using (i.e. Mac or Windows).

Testing the R markdown system

Click on the icon in the top-left corner of the window and select “R Markdown…” In the window that pops up, click “OK”. Upon clicking “OK”, a new sub-window appears in the top-left of our RStudio window with some default text.


Click on the button (or use the shortcut Cmd/Ctrl + Shift + K) to knit the document. You will be prompted to save the file (if not already saved). Just save it as “Untitled.Rmd” for now.

After some time, a preview of the document should open up in a new window, looking like this:


(It’s possible that your preview shows up in the “Viewer” window in the bottom-left corner as well. To expand it to a new window, click the “Show in new window” button (on the right of the broom icon).)

If you followed along and everything went fine, great! You are ready to go. If you ran into any issues along the way, please send me the error message, along with a description of what happened, your R & RStudio versions, and your operating system. That will help me to figure out what might have gone wrong.